const Mock = require('mockjs');
const fs = require('fs');

const data = Mock.mock({
    'users|10-20': [
        {
          'id|+1': 1,
          username: '@name',
          password: /[0-9a-zA-Z]{6,12}/,
          nickname: '@cname',
          'age|18-35': 1,
          gender: '@cword("男女")',
          email: '@email',
          desc: '@ctitle(30, 50)'
        }
      ],
      'goods|1200-1400': [
        {
          'id|+1': 1,
          title: '@ctitle(20, 30)',
          'price|100-200.2': 1,
          url: '@url'
        }
      ]
})

fs.writeFile('./mydata.json',JSON.stringify(data),()=>{})